﻿using System.Collections.Generic;
using UnityEngine;


public class BaseProxy<T> where T:BaseModel
{

    private List<T> ModelList;


    public BaseProxy()
    {
        ModelList = new List<T>();
    
    }

    public void Add(T model)
    {
        if (null == model)
        {
            Debug.LogError("参数不能为空");
            return;
        }
        ModelList.Add(model);
    }

    public T GetModelByID(int id)
    {
        foreach (var item in ModelList)
        {
            if (item.ID == id)
            {
                return item;
            }
        }
        return default(T);
    }

    public List<T> GetModelList()
    {
        return ModelList;
    }

}
